package com.shruijin.wy.property.common.rpc;

import com.shruijin.common.rpc.RpcResult;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;

@Aspect
public class RpcResultHandler {

    @Around(value = "execution(* com.shruijin.wy.property.modules.*.service.*Service+.*(..))")
    public Object aroundMethod(ProceedingJoinPoint joinPoint) throws Throwable {
        try {
            return joinPoint.proceed();
            //TODO 异常分类
        }catch (Exception e){
            return new RpcResult<>(400, e.getMessage(), false, null);
        }
    }
}
